{% extends "users/nav.html" %}

{% block torso %}
{# XXX Fix MEDIA src #}
<!-- MEDIA include animation /js/common.js /js/ldform.js -->

<form action="{{ form_action }}" method="POST" enctype="multipart/form-data">

{% if form.errors %}
<div class="hcp-error">
<span id="hcp-error-indicator">Error:</span> Please correct the errors indicated below.
</div>
{% endif %}


{{ form }}

<input type="submit" value="Submit">
</form>

{% endblock %}

{% block js %}
{{ super() }}
<script type="text/javascript">
{# Automatically fills out the home directory field (if it has not been changed). #}
function homeDirectoryAutoFill() {
  var homeDirInput = getObj("id_homeDirectory");
  var prevValue = getObj("id_uid__0").value;

  function uidChange() {
    if (homeDirInput.value.length == 0 || homeDirInput.value == '{{ HOME_DIRECTORY }}'+prevValue) {
      homeDirInput.value = '{{ HOME_DIRECTORY }}'+this.value;
    }
    prevValue = this.value;
  }

  YAHOO.util.Event.addListener("id_uid__0", "keyup", uidChange);
}

YAHOO.util.Event.onDOMReady(homeDirectoryAutoFill);

</script>
{% endblock %}
